package cn.bone.demo.mongo.bean;

import org.mongodb.morphia.annotations.NotSaved;
import org.mongodb.morphia.annotations.Transient;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * Created by MD-01 on 2016/9/26.
 */
public class TimeCycle {

    @NotSaved
    private LocalTime startTime;
    @NotSaved
    private LocalTime endTime;
    private String startTimeStr;
    private String endTimeStr;

    public LocalTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalTime startTime) {
        this.startTime = startTime;
        startTimeStr = startTime.format(DateTimeFormatter.ofPattern("HH:mm:ss"));
    }

    public LocalTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalTime endTime) {

        this.endTime = endTime;
        endTimeStr = endTime.format(DateTimeFormatter.ofPattern("HH:mm:ss"));

    }
    public String getStartTimeStr() {
        return startTimeStr;
    }

    public void setStartTimeStr(String startTimeStr) {
        this.startTimeStr = startTimeStr;
        this.startTime = LocalTime.parse(startTimeStr,DateTimeFormatter.ofPattern("HH:mm:ss"));
    }

    public String getEndTimeStr() {
        return endTimeStr;
    }

    public void setEndTimeStr(String endTimeStr) {
        this.endTimeStr = endTimeStr;
        this.endTime = LocalTime.parse(endTimeStr,DateTimeFormatter.ofPattern("HH:mm:ss"));
    }
}
